use alex_album::{
    bootstrap,
    entities::{self},
};
use sea_orm::{ActiveValue, EntityTrait};
use std::{fs, io::Write};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let db = bootstrap::db_init().await?;

    let _album = entities::album::ActiveModel {
        name: ActiveValue::Set("红山动物园".to_owned()),
        description: ActiveValue::Set(Some("南京红山动物园".to_owned())),
        ..Default::default()
    };

    let res = entities::album::Entity::insert(_album)
        .exec_with_returning(&db)
        .await?;

    println!("{:#?}", res.id);
    let mut fp = fs::File::create("./examples/id")?;
    let _ = fp.write_all(res.id.as_bytes());
    Ok(())
}
